/*
 * Copyright (c) 2023 Huawei Technologies Co., Ltd.
 * openUBMC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *         http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

#ifndef NCSI_OVER_MCTP_WX_H
#define NCSI_OVER_MCTP_WX_H

#include <mctp/mctp.h>
#include <ncsi/ncsi_wx.h>
#include <ncsi_over_mctp/ncsi_over_mctp_standard.h>

namespace dev {
// 网迅厂商ID
#define WX_MANUFACTURE_ID     0x57584B4A
#define RSP_WX_MANUFACTURE_ID 0x4A4B5857
// manufacture_id + command_rev + command_id
#define WX_COMMON_DATA(command_rev, command_id) {0x57, 0x58, 0x4B, 0x4A, command_rev, command_id}
#define WX_COMMON_DATA_SIZE                     6
#define WX_GET_TEMP_CHANNEL_ID                  0x1F

#define WX_FIXED_ENDPOINT_PHY_ADDR 73

typedef struct wx_ncsi_sff_info {
    uint16_t temp_high_alarm;
    uint16_t temp_high_warning;
    uint16_t temp_value;
    uint16_t tx_output_pwr;
    uint16_t rx_input_pwr;
    uint8_t  media_type;
} wx_ncsi_sff_info_t;

class MC_API ncsi_over_mctp_wx : public ncsi_over_mctp_standard {
public:
    ncsi_over_mctp_wx(mctp& mctp_obj) : ncsi_over_mctp_standard(mctp_obj) {};
    // WX网卡支持的特定功能
    bool get_temperature(uint8_t package_id, uint8_t channel_id, uint16_t* temp_info);
    bool get_mac_address(uint8_t package_id, uint8_t channel_id, uint8_t* mac_info, uint8_t len);
    bool get_serial_number(uint8_t package_id, uint8_t channel_id, std::string& sn_info);
    bool enable_lldp(uint8_t package_id, uint8_t channel_id);
    bool disable_lldp(uint8_t package_id, uint8_t channel_id);
    bool get_lldp_capability(uint8_t package_id, uint8_t channel_id, uint8_t* lldp_capability);
    bool set_lldp(uint8_t package_id, uint8_t channel_id, uint8_t enable_flag);
    bool get_sff_info(uint8_t package_id, uint8_t channel_id, wx_ncsi_sff_info_t *sff_info);
    bool get_vpd_sn(uint8_t package_id, uint8_t channel_id, uint8_t *vpd_sn, uint8_t *sn_len);
    bool get_vpd_pn(uint8_t package_id, uint8_t channel_id, uint8_t *vpd_pn, uint8_t *pn_len);
    // bool get_link_status  直接继承基类的函数
};

} // namespace dev
#endif // NCSI_OVER_MCTP_WX_H
